<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .last {
        width: 200px;
        height: 200px;
        background-color: pink;
    }
    
    .later {
        width: 300px;
        height: 250px;
        background-color: purple;
    }
</style>

<body>
    <div class="last">
    </div>
    <script>
        var d = document.querySelector('div');
        var num = 0;
        d.onclick = function() {
            if (num == 0) {
                d.className = 'later';
                num = 1;
            } else {
                d.className = 'last'
                num = 0;
            }
        }
    </script>
</body>

</html>